# -*- coding:utf-8 -*-


class Solution(object):
    def isPalindrome(self, x):
        """
        :type x: int
        :rtype: bool
        """
        if x < 0:
            return False

        p, q = x, 0

        while p >= 10:
            q *= 10
            q += p % 10
            p /= 10

        return q == x / 10 and p == x % 10

print Solution().isPalindrome(12321)
